<template>
	<view>
		<dsl-navbar title="动态消息" bgTopImg="white" isBack></dsl-navbar>
		<view class="rowsb align-center padding">
			<view class="align-center ">
				<view>谁看过我</view>
				<view class="margin-left-xl " :class="{'animate_animated animate_bounce':browsingList.length!=0}">
					<image :src="item.userAvatar" mode="aspectFill" v-for="(item,index) in browsingList"
						class="head_image" v-if="index<6"></image>
				</view>
			</view>
			<view class="text-gray" @click="$tools.push('/pages/message/browseList')">
				<text>全部</text>
				<text class="cuIcon-right"></text>
				<text class="cuIcon-right " style="margin-left: -17rpx;"></text>
			</view>
		</view>
		<view class="message_body solid-bottom" v-for="(item,index) in activeList" :key='index'
			@click="$tools.push('/pages/dynamic/detail?id='+item.momentsId)" hover-class=" bg-gray">
			<view class="align-center">
				<image :src="item.userAvatar" mode="aspectFill" class="head_images" @click.stop="chatHome(item)">
				</image>
				<view class="margin-left ">
					<view class="title one_overflow">{{item.userName}}</view>
					<view class="align-center margin-tb-sm justify-between">
						<view class="content one_overflow">{{item.content ||'暂无评论'}}</view>
						<view class="time one_overflow">{{item.createTime}}</view>
					</view>
					<view>
						<image src="/static/message/imgdianzan-1.png" mode="" class="icon"
							@click.stop="likeMomentsApi({ momentsId:item.momentsId })"></image>
						<!-- <image src="/static/message/imgdianzan.png" mode="" class="icon margin-left"></image> -->
						<image src="/static/message/imgxingxing.png" mode="" class="icon margin-left"></image>
						<!-- <image src="/static/message/imgxingxing-5.png" mode="" class="icon margin-left"></image> -->
					</view>
				</view>
			</view>
			<image :src="item.cover" mode="aspectFill" class="image bg-gray"></image>
		</view>

	</view>
</template>

<script>
	import {
		mapState,
		mapActions
	} from 'vuex'
	export default {
		data() {
			return {
				pageNum: 1
			}
		},
		//生命周期函数
		onReady() {},
		onLoad() {
			this.getbrowsingHistory({
				pageNum: 1, //第一页
				pageSize: 6
			}) //谁看过我
			this.interactiveList({
				pageNum: 1,
			}) //动态列表
		},
		onShow() {},
		methods: {
			/**
			 *  getbrowsingHistory 查看谁看过我
			 */
			...mapActions('message', ['getbrowsingHistory', 'interactiveList']),
			/**
			 * likeMomentsApi 动态点赞
			 */
			...mapActions('dynamic', ['likeMomentsApi']),
			chatHome() { //他人首页跳转
				uni.navigateTo({
					url: '/pages/message/userHome/index'
				})
			},
			onReachBottom(e) { //触底
				this.pageNum++
				this.interactiveList({
					pageNum: this.pageNum,
				})
			},

		},
		computed: {
			...mapState('message', ['browsingList', 'activeList']),

		},
		components: {

		}
	}
</script>

<style lang="scss">
	//顶部头像
	.head_image {
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
		opacity: 1;
		margin-left: -27rpx;
	}

	.message_body {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 30rpx;

		.head_images {
			width: 88rpx;
			height: 88rpx;
			background: #FF8F2E;
			border-radius: 50%;
		}

		.title {
			width: 328rpx;
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
			opacity: 1;
		}

		.content {
			width: 283rpx;
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #9AA2B5;
			opacity: 1;
		}

		.time {
			font-size: 20rpx;
			font-family: PingFang SC;
			width: 100rpx;
			color: #B7BED8;
			opacity: 1;
		}

		.icon {
			width: 30rpx;
			height: 30rpx;
		}

		.image {
			width: 150rpx;
			height: 150rpx;
			border-radius: 7rpx;
		}
	}
</style>
